home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 9 / CorelDraw9 Disco 1.iso / Scripts / imagevw.csc < prev    next >
Text File  |  1998-07-30  |  2KB  |  67 lines

  1. REM Visualiza un mapa de bits en un cuadro modificable.
  2. REM ImageVw.csc 29 de julio de 1996
  3. REM Copyright 1996 Corel Corporation.  Reservados todos los derechos.
  4.  
  5. REM ***************************************************************
  6. REM * Global Data                                                 *
  7. REM ***************************************************************
  8.  
  9. #include "ScpConst.csi"
  10.  
  11. REM ***************************************************************
  12. REM * Main Dialog                                                 *
  13. REM ***************************************************************
  14. BEGIN DIALOG OBJECT MainDialog 200, 100, "Corel SCRIPT Image Viewer", SUB MainDialogSub
  15.     TEXT  5, 6, 120, 10, .Filename, ""
  16.     IMAGE  5, 25, 190, 70, .ImageView
  17.     PUSHBUTTON  135, 5, 60, 14, .Browse, "Browse"
  18. END DIALOG
  19.  
  20. 'Initialize the styles for the controls
  21. MainDialog.SetStyle STYLE_MINIMZERESIZE
  22. MainDialog.FileName.SetStyle STYLE_SUNKEN
  23. MainDialog.ImageView.SetStyle STYLE_SUNKEN
  24.  
  25. 'Execute the dialog
  26. DIALOG MainDialog
  27.  
  28. REM ***************************************************************
  29. REM * MainDialogSub: handles both the Browse button and the       *
  30. REM * dialog resizing.                                            *
  31. REM ***************************************************************
  32. SUB MainDialogSub(BYVAL ControlID%, BYVAL Event%)
  33.     DIM FileName AS STRING
  34.     DIM DialogWidth AS INTEGER
  35.     DIM DialogHeight AS INTEGER
  36.     DIM ImageHeight AS INTEGER
  37.     DIM ImageWidth AS INTEGER
  38.  
  39.     WITH MainDialog
  40.         IF Event% = EVENT_MOUSE_CLICK THEN
  41.             'Only Browse button
  42.             FileName$ = GETFILEBOX("Bitmap files (*.bmp)|*.bmp")
  43.             IF FileName$ <> "" THEN
  44.                 .FileName.SetText FileName$
  45.                 .ImageView.SetImage FileName$
  46.             ENDIF
  47.         ENDIF
  48.         IF Event% = 6 THEN
  49.             'Make sure the dialog has a reasonable size
  50.             DialogWidth% = .GetWidth()
  51.             IF DialogWidth% < 100 THEN DialogWidth% = 100
  52.             DialogHeight% = .GetHeight()
  53.             IF DialogHeight% < 60 THEN DialogHeight% = 60
  54.             .Move .GetLeftPosition(), .GetTopPosition(), DialogWidth%, DialogHeight%
  55.             'Resize the image
  56.             ImageHeight% = DialogHeight% - 30
  57.             ImageWidth% = DialogWidth% - 10
  58.             .ImageView.Move 5,25,ImageWidth%, ImageHeight%
  59.             'Resize the file name
  60.             .FileName.Move 5, 6, DialogWidth% - 80, 10
  61.             'Reposition the move button
  62.             .Browse.Move DialogWidth% - 65, 5
  63.         ENDIF
  64.     END WITH
  65. END SUB
  66.  
  67.